package com.rw.controller;

import com.rw.pojo.User;
import com.rw.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class TestCOntroller {

    @Autowired
    private UserService userService;

    @RequestMapping("a")
    public String getTest(){
        System.out.println("TestCOntroller.getTest");
        return "test";
    }


    @PostMapping("apiLogin")
    @ResponseBody
    public User login(String uname,String pwd) {
        System.out.println("LoginController.login"+uname+"----"+pwd);
        User user = userService.getLogin(uname,pwd);
        System.out.println(user);
        return user;
    }
}
